package co.fitstart.entity.credit.product;

import com.demo2do.core.utils.Alias;

/**
 * 
 * @author mohanlan
 *
 */
@Alias("creditProductType")
public enum CreditProductType {
	
	COUPON("虚拟卷", "coupon"),
	
	PRODUCT("实物", "product");
	
	private String description;
    
    private String alias;
    
    /**
     * 
     * @param description
     * @param alias
     */
    private CreditProductType(String description, String alias) {
		this.description = description;
		this.alias = alias;
	}
    
    /**
     * 
     * @return
     */
    public boolean isCoupon() {
    	return this.equals(COUPON);
    }
    
    /**
     * 
     * @return
     */
    public boolean isProduct() {
    	return this.equals(PRODUCT);
    }
	/**
     * 
     * @param alias
     * @return
     */
    public static CreditProductType aliasOf(String alias) {
        for (CreditProductType productType : CreditProductType.values()) {
            if (productType.getAlias().equalsIgnoreCase(alias)) {
                return productType;
            }
        }
        return null;
    }
    
    /**
     * 
     * @return
     */
	public String getDescription() {
		return description;
	}
	
	/**
	 * 
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * 
	 * @return
	 */
	public String getAlias() {
		return alias;
	}
	
	/**
	 * 
	 * @param alias
	 */
	public void setAlias(String alias) {
		this.alias = alias;
	}
    
    
}
